/*初始化日历数据*/

var monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
var dayNames = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];

/**
 * 判断是否能选中，所以这个地方还需要获取能预约的时间，每个月的
 * @param date
 * @returns {boolean}
 */
var judgeDisable = function judgeDisabled(date) {
    return !(date.getDate() < 15 || date.getDate() > 25);

};

var calendarInline = myApp.calendar({
    container: '#sign-calendar-inline-container',
    value: [new Date()],
    weekHeader: true,
    firstDay: 0,
    dayNames: dayNames,
    dayNamesShort: dayNames,
    weekendDays: [0, 6],
    disabled: judgeDisable,
    toolbarTemplate:
    '<div class="toolbar calendar-custom-toolbar" style="background-color: white">' +
    '<div class="toolbar-inner">' +
    '<div class="left">' +
    '<a href="#" class="link icon-only"><i class="icon icon-back"></i></a>' +
    '</div>' +
    '<div class="center"></div>' +
    '<div class="right">' +
    '<a href="#" class="link icon-only"><i class="icon icon-forward"></i></a>' +
    '</div>' +
    '</div>' +
    '</div>',
    onOpen: function (p) {
        $$('.calendar-custom-toolbar .center').text(p.currentYear + '年' + monthNames[p.currentMonth]);
        $$('.calendar-custom-toolbar .left .link').on('click', function () {
            calendarInline.prevMonth();
        });
        $$('.calendar-custom-toolbar .right .link').on('click', function () {
            calendarInline.nextMonth();
        });
    },
    onMonthYearChangeStart: function (p) {
        $$('.calendar-custom-toolbar .center').text(p.currentYear + '年' + monthNames[p.currentMonth]);
    },
    onDayClick: function (p, dayContainer, year, month, day) {
        //getSignInfoByDate(year + '-' + (parseInt(month) + 1) + '-' + day)
    }
});
